extends Node


## 加载数据
func load_data(data_path:String)->Variant:
	if FileAccess.file_exists(data_path):
		var file = FileAccess.open(data_path, FileAccess.READ)
		var json_data = file.get_as_text()
		file.close()
		
		var json = JSON.new()
		var parsed_data = json.parse(json_data)
		if parsed_data == OK:
			return json.data
		else:
			print("JSON解析错误")
			return null
	else:
		return null
	

## 存储数据
func save_data(data_path:String,data):
	var file = FileAccess.open(data_path, FileAccess.WRITE)

	var json_data = JSON.stringify(data)
	file.store_string(json_data)
	file.close()
	
